#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void console(int * num, int size) {
  printf("\n");
  for (int i = 0; i < size; i++) {
    printf("%d", num[i]);
  }
}

void printChar(char *s, int a) { printf("\n%s=%d", s, a); }

void quickSort(int *number, int first, int last) {
  int i, j, pivot;
  int temp;
  if (first<last) {
    pivot = first;
    i = first;
    j = last;
    while (i<j) {
      while (number[i] <= number[pivot] && i<last)
        i++;
      printChar("i", i);
      while (number[j]>number[pivot])
        j--;
      printChar("j", j);
      if (i<j) {
        temp = number[i];
        number[i] = number[j];
        number[j] = temp;
      }
    }
    temp = number[pivot];
    number[pivot] = number[j];
    number[j] = temp;
    quickSort(number, first, j - 1);
    quickSort(number, j + 1, last);
  }
}


int main() {
  int a[11] = {5, 3, 7, 6, 4, 1, 0, 2, 9, 10, 8};

  quickSort(a, 0, 11);
}